package com.springboot2.authserver.jwt.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.List;

/**
 * 账户实体类
 *
 * @author miaoyang
 */
@Data
public class User implements UserDetails, Serializable {
    @Id
    private String id;          // 主键
    private String username;    // 用户名
    private String password;    // 密码
    private String[] roles;     // 角色
    private List<GrantedAuthority> authorities;


    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
